import {axios} from "axios";
import {ElMessage} from "element-plus";

const myMixin = {
    data() {
        return {
            queryinfo: {
                page: 1,
                size: 10
            },
            currentPage: 1, // 当前页
            pageSize: 10, // 分页大小
            total: 0,
            tableData: [],
            url:""
        }
    },
    methods: {
        async GetData() {
            const {data: res} = await axios.get(this.url, {params: this.queryinfo})
            if (res.code !== 1000) return ElMessage.error(res.msg)
            this.tableData = res.data.list
            this.total = res.data.total
        },
        changePage(val) {
            console.log(11)
            this.queryinfo.page = val
            this.GetData()
        },
        handleSizeChange(val) {
            this.queryinfo.size = val
            this.GetData()
        }
    }

}

export default myMixin